package com.zyht.common.excel;

import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;


abstract class ImportAdapter<T> implements IImport<T> {

	private IPersist<T> persist;
	
	@Override
	public int doImport(InputStream is,Class<T> clazz) throws InvalidFormatException,IOException{
		if(null==persist){
			throw new NullPointerException("无法打入数据，数据导入业务处理bean注入失败……");
		}
		return doImport(persist,is, clazz);
	}
	
	public abstract int doImport(IPersist<T> persist, InputStream is, Class<T> clazz) throws InvalidFormatException,IOException;
	
	public void setPersist(IPersist<T> persist){
		this.persist = persist;
	}
}
